<?php
// http://codeigniter.com/wiki/Display_helper/

/*
| ----------------------------
| show value if it's not the same as the default value
| ----------------------------
*/
function display($value, $default, $replacement = NULL)
{
    return ($value == $default)?(( ! is_null($replacement))?$replacement:''):$value;
}

/*
| ----------------------------
| check if value is (not) the same as the default value
| ----------------------------
*/
function is_default($value, $default)
{
    return ($value == $default)?TRUE:FALSE;
}

/*
| ----------------------------
| show value or a formatted string with the value in it when the value exists
| ----------------------------
*/
function display_isset($value, $str='')
{
   if( ! isset($value))
   {
       return '';
   }

   if($str != '')
   {
      return sprintf($str, $value);
   }

   return $value;
} 

?>